package cn.jason.websocket.controller;

import cn.jason.websocket.servers.WebSocketServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {
    // 创建订单，时间耗费较长，反馈用户等待创建结果
    @Autowired
    private WebSocketServer webSocketServer;
    @GetMapping("/order/add")
    public String addOrder(Integer userId){
        System.out.println("正在创建订单...");
        webSocketServer.sendMsg2User("正在创建订单，请耐心等待...", userId);
        return "正在创建订单，请耐心等待...";
    }
}
